#pragma once

#include<mymuduo/TcpServer.h>
#include<mymuduo/EventLoop.h>

class ChatServer{
public:
    ChatServer(
        EventLoop *loop,
        const InetAddress &addr,
        const std::string &name
    );
    ~ChatServer();

    //启动服务器
    void start();


private:
    void onConnection(const TcpConnectionPtr&);
    void onMessage(const TcpConnectionPtr&,Buffer*,Timestamp);
    EventLoop *_loop;
    TcpServer _server;
};